﻿using System;
using System.Web;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web.Services;
using System.Web.Services.Protocols;
using AjaxControlToolkit;
using System.Data;
using System.Data.SqlClient;

namespace PSI
{
    /// <summary>
    /// Summary description for daneDoList1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.Web.Script.Services.ScriptService]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class daneDoList1 : System.Web.Services.WebService
    {

        [WebMethod]
        [System.Web.Script.Services.ScriptMethod]
        public CascadingDropDownNameValue[] GetMakes(string knownCategoryValues, string category)
        {

            
            List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
           
               
                values.Add(new CascadingDropDownNameValue("s1", "1"));
            
            return values.ToArray();
        }

         [WebMethod]
         [System.Web.Script.Services.ScriptMethod]
        public CascadingDropDownNameValue[] GetMakes1(string knownCategoryValues, string category)
        {


            StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
            int makeId;
            if (!kv.ContainsKey("Make") || !Int32.TryParse(kv["Make"], out makeId))
            {
                return null;
            }
            
            List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
            
             if(makeId==1)
                values.Add(new CascadingDropDownNameValue("if","2"));
             else
                 values.Add(new CascadingDropDownNameValue(knownCategoryValues.ToString(), "2"));
            
            return values.ToArray();
        }

        [WebMethod]
        [System.Web.Script.Services.ScriptMethod]
         public CascadingDropDownNameValue[] GetMakes2(string knownCategoryValues, string category)
         {
             List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
             values.Add(new CascadingDropDownNameValue("if", "2"));
             return values.ToArray();
         }
    }
}
